package annotation;

import java.lang.reflect.Method;

/**
 * @author shentianyu
 * @date 2021-06-28 23:38
 */


//重复注解与类型注解
public class TestAnnotation {

    public static void main(String[] args) throws Exception {
        Class<TestAnnotation> aClass = TestAnnotation.class;
        Method method = aClass.getMethod("show");
        MyAnnotation[] annotationsByType = method.getAnnotationsByType(MyAnnotation.class);
        for (int i = 0; i < annotationsByType.length; i++) {
            System.out.println(annotationsByType[i]);
        }
    }

    @MyAnnotation("Hello")
    @MyAnnotation("World")
    public void show(){
        System.out.println("-------");
    }
}
